<div id="container" style="width:90%; margin:0 auto;"></div>

<div class="SipeiStat border_3 pb20 centered back_bgf mt20">
  <h1 class="clearfix pl20 mb20 fonts_18 height40 fontc_444 fontw_normal back_bgfd">成绩汇总（总分及三门平均分表）
  </h1>
  <form class="clearfix pt20 pr20 pb20 pl20">
    <table class="fontc_666 height32">
      <thead class="back_bgf5 fontc_999">
        <tr>
          <th width="63" align="center" class="border_d">区域</th>
          <th width="64" align="center" class="border_d">人数</th>
          <th width="87" align="center" class="border_d">理总</th>
          <th width="87" align="center" class="border_d">文总</th>
          <th width="88" align="center" class="border_d">理语</th>
          <th width="87" align="center" class="border_d">文语</th>
          <th width="87" align="center" class="border_d">理数</th>
          <th width="87" align="center" class="border_d">文数</th>
          <th width="87" align="center" class="border_d">理英</th>
          <th width="88" align="center" class="border_d">文英</th>
        </tr>
      </thead>
      <tbody class="fontc_444">
        <tr>
          
          <td align="center" class="border_d">全市</td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['num'])) ? $tongji['num'] : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['li_num'])) ? sprintf("%.2f",($tongji['li_count'] / $tongji['li_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['wen_num'])) ? sprintf("%.2f",($tongji['wen_count'] / $tongji['wen_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['liyu_num'])) ? sprintf("%.2f",($tongji['liyu_count'] / $tongji['liyu_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['wenyu_num'])) ? sprintf("%.2f",($tongji['wenyu_count'] / $tongji['wenyu_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['lishu_num'])) ? sprintf("%.2f",($tongji['lishu_count'] / $tongji['lishu_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['wenshu_num'])) ? sprintf("%.2f",($tongji['wenshu_count'] / $tongji['wenshu_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['liying_num'])) ? sprintf("%.2f",($tongji['liying_count'] / $tongji['liying_num'])) : 0 ; ?></td>
          <td align="center" class="border_d"><?php  echo (!empty($tongji['wenying_num'])) ? sprintf("%.2f",($tongji['wenying_count'] / $tongji['wenying_num'])) : 0 ; ?></td>
        </tr>
        
        <?php if(!empty($region)): ?>
        <?php
        $array['data'] = array(
        	(!empty($tongji['li_num'])) ? floatval(sprintf("%.2f",($tongji['li_count'] / $tongji['li_num']))) : 0 ,
        	(!empty($tongji['wen_num'])) ? floatval(sprintf("%.2f",($tongji['wen_count'] / $tongji['wen_num']))) : 0 ,
        	(!empty($tongji['liyu_num'])) ? floatval(sprintf("%.2f",($tongji['liyu_count'] / $tongji['liyu_num']))) : 0 ,
        	(!empty($tongji['wenyu_num'])) ? floatval(sprintf("%.2f",($tongji['wenyu_count'] / $tongji['wenyu_num']))) : 0 ,
        	(!empty($tongji['lishu_num'])) ? floatval(sprintf("%.2f",($tongji['lishu_count'] / $tongji['lishu_num']))) : 0 ,
        	(!empty($tongji['wenyu_num'])) ? floatval(sprintf("%.2f",($tongji['wenshu_count'] / $tongji['wenyu_num']))) : 0 ,
        	(!empty($tongji['liying_num'])) ? floatval(sprintf("%.2f",($tongji['liying_count'] / $tongji['liying_num']))) : 0 ,
        	(!empty($tongji['wenying_num'])) ? floatval(sprintf("%.2f",($tongji['wenying_count'] / $tongji['wenying_num']))) : 0 ,
        );
        
         $data_photo[0]['name'] = '全市';
         $data_photo[0]['data'] = $array['data'];       
        ?>
        <?php foreach ($region as $value): ?>
        <?php $array['name'] = $value['name']; ?>
       <?php $array['data'] = array(
       	(!empty($value['li_num'])) ? floatval(sprintf("%.2f",($value['li_count'] / $value['li_num']))) : 0,
       	(!empty($value['wen_num'])) ? floatval(sprintf("%.2f",($value['wen_count'] / $value['wen_num']))) : 0,
       	(!empty($value['liyu_num'])) ? floatval(sprintf("%.2f",($value['liyu_count'] / $value['liyu_num']))) : 0,
       	(!empty($value['wenyu_num'])) ? floatval(sprintf("%.2f",($value['wenyu_count'] / $value['wenyu_num']))) : 0,
       	(!empty($value['lishu_num'])) ? floatval(sprintf("%.2f",($value['lishu_count'] / $value['lishu_num']))) : 0,
       	(!empty($value['wenshu_num'])) ? floatval(sprintf("%.2f",($value['wenshu_count'] / $value['wenshu_num']))) : 0,
       	(!empty($value['liying_num'])) ? floatval(sprintf("%.2f",($value['liying_count'] / $value['liying_num']))) : 0,
       	(!empty($value['wenying_num'])) ? floatval(sprintf("%.2f",($value['wenying_count'] / $value['wenying_num']))) : 0
       ); ?>
       
       
        <tr>
          <td align="center" class="border_d"><?php echo $value['name']; ?></td>
          <td align="center" class="border_d"><?php echo $value['student_nums'];?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['li_num'])) ? sprintf("%.2f",($value['li_count'] / $value['li_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['wen_num'])) ? sprintf("%.2f",($value['li_count'] / $value['wen_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['liyu_num'])) ? sprintf("%.2f",($value['liyu_count'] / $value['liyu_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['wenyu_num'])) ? sprintf("%.2f",($value['wenyu_count'] / $value['wenyu_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['lishu_num'])) ? sprintf("%.2f",($value['lishu_count'] / $value['lishu_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['wenshu_num'])) ? sprintf("%.2f",($value['wenshu_count'] / $value['wenshu_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['liying_num'])) ? sprintf("%.2f",($value['liying_count'] / $value['liying_num'])) : 0;?></td>
          <td align="center" class="border_d"><?php echo (!empty($value['wenying_num'])) ? sprintf("%.2f",($value['wenying_count'] / $value['wenying_num'])) : 0;?></td>  
        </tr>
<?php 
	$data_photo[] = $array;
	
		 ?>
<?php endforeach;?>
<?php endif; ?>

<?php 
	$name = array('理总','文总','理语','文语','理数','文数','理英','文英');
	$array = json_encode($name);
	$data_photo = json_encode($data_photo);
?>
      </tbody>
    </table>
  </form>
  
 
<script type="text/javascript">
		
		function charts_line( type,categories,data ){
			$('#container').highcharts({
				title: {
					text: '成绩汇总',
					x: 0 //
				},
				subtitle: {
					text: type,
					x: 0
				},
				xAxis: {
					categories: categories
				},
				yAxis: {
					title: {
						text: ''
					},
					plotLines: [{
						value: 0,
						width: 1,
						color: '#808080'
					}]
				},
                chart: {
                    type: 'column'
                },
				tooltip: {
					valueSuffix: '人'
				},
				credits: {
					text: '',
					href: 'http://www.example.com'
				},
				series:data 
			});
			
		
		}


$(function () {
			var type = '（总分及三门平均分统计）',
			 	categories = <?php echo $array;?>,
		     	 data = <?php echo $data_photo;?>;

			charts_line( type,categories,data );
				    
});
</script>
  
  
  
  
  
  
  
  
</div>